<?php

namespace easydis\APSBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class RoutingController extends Controller
{
    public function choose_exploitAction($date, $idsite) {
        $em = $this->getDoctrine()->getManager();
		
        $repository_ex = $em->getRepository('easydisAPSBundle:Exploitation');
        
        $tabResult = array();
        $ligne = 0;
        $list_ex = $repository_ex->findBy(array('site' => $idsite));
        foreach($list_ex as $ex) {
            $tabResult[$ligne] = $ex;
            $ligne = $ligne + 1;
        }

        $choix = '';
        return $this->render('easydisAPSBundle:Routing:choose_exploit.html.twig', array('tabResult' => $tabResult));
    }
    
    public function choose_gsAction($date, $exploit, $choix, $type) {
        $em = $this->getDoctrine()->getManager();
		
        $repository_gs = $em->getRepository('easydisAPSBundle:GroupeService');
        
        $tabResult = array();
        $ligne = 0;
        $list_gs = $repository_gs->findBy(array('exploit' => $exploit, 'type' => $type));
        foreach($list_gs as $gs) {
            $tabResult[$ligne] = $gs;
            $ligne = $ligne + 1;
        }
        
        $route = 'easydisAPSBundle_dashboard_gs';
        if($choix == 'easyprod')
            $route = 'easydisAPSBundle_dashboard_gs';
        if($choix == 'effectif')
            $route = 'easydisAPSBundle_dashboard_gs';
        if($choix == 'planning')
            $route = 'easydisAPSBundle_planning_view';
        if($choix == 'planif_groupe')
            $route = 'easydisAPSBundle_planifier_groupe_salarie';
        if($choix == 'modif_plagehoraire')
            $route = 'easydisAPSBundle_planning_lister_plageshoraires';
        if($choix == 'modif_poste')
            $route = 'easydisAPSBundle_planning_lister_postes';
        if($choix == 'modif_visi_effectif')
            $route = 'easydisAPSBundle_planning_lister_effectif';
        if($choix == 'vision_mois')
            $route = 'easydisAPSBundle_planning_vision_mensuelle';
        
        
        return $this->render('easydisAPSBundle:Routing:choose_gs.html.twig', array('route' => $route, 'tabResult' => $tabResult));
    }
    
    public function ajout_succesAction() {
        return $this->render('easydisAPSBundle:Routing:ajout_succes.html.twig');
    }
    
    public function gestion_plageshoraires_planningAction() {
        return $this->render('easydisAPSBundle:Routing:gestion_planning_plageshoraires.html.twig');
    }
    
    public function gestion_postes_planningAction() {
        return $this->render('easydisAPSBundle:Routing:gestion_planning_postes.html.twig');
    }
    
    public function gestion_salaries_rhAction() {
        return $this->render('easydisAPSBundle:Routing:gestion_rh_salarie.html.twig');
    }
}